#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

// 二分查找 板子

using namespace std;

// 使用 map 来稀疏地存储棋盘上的标记
// key: 坐标, value: 标记字符
map<int, char> rows[100001];        // rows[x][y] = t
map<int, char> cols[100001];        // cols[y][x] = t
map<int, char> up_rights[200002];   // up_rights[x+y][x] = t
map<int, char> down_rights[200001]; // down_rights[x-y+m][x] = t

int n, m;

// 辅助函数：在所有数据结构中插入标记
void insert_mark(int x, int y, char t)
{
    rows[x][y] = t;
    cols[y][x] = t;
    up_rights[x + y][x] = t;
    down_rights[x - y + m][x] = t;
}

// 辅助函数：在所有数据结构中移除标记
void remove_mark(int x, int y)
{
    if (rows[x].count(y))
    {
        rows[x].erase(y);
        cols[y].erase(x);
        up_rights[x + y].erase(x);
        down_rights[x - y + m].erase(x);
    }
}

void solve()
{
    int x, y;
    char type;
    cin >> x >> y >> type;

    // 1. 处理投掷位置的标记
    char original_mark = '.';
    if (rows[x].count(y))
    {
        original_mark = rows[x][y];
    }
    cout << original_mark << " ";
    insert_mark(x, y, type);

    // 2. 计算飞行时间 T
    int time_to_fly = 1e9;

    // 检查每个方向的碰撞或出界时间
    // 上
    if (type == '+' || type == '*')
    {
        auto it = cols[y].lower_bound(x);
        if (it != cols[y].begin())
            time_to_fly = min(time_to_fly, x - prev(it)->first);
        time_to_fly = min(time_to_fly, x); // 出界
    }
    // 下
    if (type == '+' || type == '*')
    {
        auto it = cols[y].upper_bound(x);
        if (it != cols[y].end())
            time_to_fly = min(time_to_fly, it->first - x);
        time_to_fly = min(time_to_fly, n - x + 1); // 出界
    }
    // 左
    if (type == '+' || type == '*')
    {
        auto it = rows[x].lower_bound(y);
        if (it != rows[x].begin())
            time_to_fly = min(time_to_fly, y - prev(it)->first);
        time_to_fly = min(time_to_fly, y); // 出界
    }
    // 右
    if (type == '+' || type == '*')
    {
        auto it = rows[x].upper_bound(y);
        if (it != rows[x].end())
            time_to_fly = min(time_to_fly, it->first - y);
        time_to_fly = min(time_to_fly, m - y + 1); // 出界
    }
    // 左上
    if (type == 'x' || type == '*')
    {
        auto it = down_rights[x - y + m].upper_bound(x);
        if (it != down_rights[x - y + m].end())
            time_to_fly = min(time_to_fly, it->first - x);
        time_to_fly = min(time_to_fly, min(n - x + 1, y)); // 出界
    }
    // 左下
    if (type == 'x' || type == '*')
    {
        auto it = up_rights[x + y].lower_bound(x);
        if (it != up_rights[x + y].begin())
            time_to_fly = min(time_to_fly, x - prev(it)->first);
        time_to_fly = min(time_to_fly, min(x, y)); // 出界
    }
    // 右上
    if (type == 'x' || type == '*')
    {
        auto it = up_rights[x + y].upper_bound(x);
        if (it != up_rights[x + y].end())
            time_to_fly = min(time_to_fly, it->first - x);
        time_to_fly = min(time_to_fly, min(n - x + 1, m - y + 1)); // 出界
    }
    // 右下
    if (type == 'x' || type == '*')
    {
        auto it = down_rights[x - y + m].lower_bound(x);
        if (it != down_rights[x - y + m].begin())
            time_to_fly = min(time_to_fly, x - prev(it)->first);
        time_to_fly = min(time_to_fly, min(x, m - y + 1)); // 出界
    }

    cout << time_to_fly << " ";

    // 3. 处理每个小飞镖的结果
    vector<pair<int, int>> dirs;
    if (type == '+')
    {
        dirs = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
    }
    else if (type == 'x')
    {
        dirs = {
            {-1, -1},
            {1, -1},
            {-1, 1},
            {1, 1},
        }; // 左上、左下、右上、右下
    }
    else
    { // '*'
        dirs = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}};
    }

    string result_str = "";
    vector<pair<int, int>> new_marks_pos;
    vector<pair<int, int>> removed_marks_pos;

    for (auto d : dirs)
    {
        int nx = x + d.first * time_to_fly;
        int ny = y + d.second * time_to_fly;

        if (nx < 1 || nx > n || ny < 1 || ny > m)
        {
            result_str += 'o';
        }
        else if (rows[nx].count(ny))
        {
            result_str += rows[nx][ny];
            removed_marks_pos.push_back({nx, ny});
        }
        else
        {
            result_str += '.';
            new_marks_pos.push_back({nx, ny});
        }
    }

    // 统一进行增删操作，避免影响同一次投掷中的其他小飞镖判断
    for (auto pos : removed_marks_pos)
        remove_mark(pos.first, pos.second);
    for (auto pos : new_marks_pos)
        insert_mark(pos.first, pos.second, type);

    cout << result_str;
    cout << endl;
}

int main()
{
    int q;
    cin >> n >> m >> q;

    while (q--)
        solve();

    return 0;
}